package com.yxwl.demo.utils;

import android.util.DisplayMetrics;

public class DensityUtil {

    public static DisplayMetrics getAppDM() {
        return Utils.getContext().getResources().getDisplayMetrics();
    }


    public static float density;

    public static float getScreenDendity() {
        if (density == 0) {
            density = getAppDM().density;
        }
        return density;
    }
    public static int dp2px(float dpValue) {
        return (int) (dpValue * getScreenDendity() + 0.5f);
    }

}


